package com.my.test.img;

/**
 * 水印位置
 * @author zongbo
 *
 */
public enum MarkerPositions implements MarkerPosition {
	
	TOP_LEFT()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = insetLeft;
			int y = insetTop+height;
			return new ImagePoint(x, y);
		}
	},
	
	TOP_CENTER()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = (imageWidth / 2) - (width / 2);
			int y = insetTop+height;
			return new ImagePoint(x, y);
		}
	},
	TOP_RIGHT()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = imageWidth - width - insetRight;
			int y = insetTop+height;
			return new ImagePoint(x, y);
		}
	},
	
	CENTER_LEFT()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = insetLeft;
			int y = (imageHeight / 2) - (height / 2);
			return new ImagePoint(x, y);
		}
	},
	
	CENTER()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = (imageWidth / 2) - (width / 2);
			int y = (imageHeight / 2) - (height / 2);
			return new ImagePoint(x, y);
		}
	},

	CENTER_RIGHT()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = imageWidth - width - insetRight;
			int y = (imageHeight / 2) - (height / 2);
			return new ImagePoint(x, y);
		}
	},
	
	BOTTOM_LEFT()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = insetLeft;
			int y = imageHeight - height - insetBottom;
			return new ImagePoint(x, y);
		}
	},
	
	BOTTOM_CENTER()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = (imageWidth / 2) - (width / 2);
			int y = imageHeight - height - insetBottom;
			return new ImagePoint(x, y);
		}
	},
	
	BOTTOM_RIGHT()
	{
		public ImagePoint calculate(int imageWidth, int imageHeight,
				int width, int height, int insetLeft, int insetRight,
				int insetTop, int insetBottom)
		{
			int x = imageWidth - width - insetRight;
			int y = imageHeight - height - insetBottom;
			return new ImagePoint(x, y);
		}
	},
	;
}
